/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.ee.persistence;

/**
 *
 * @author Gabriel Bran <gbran.u@gmail.com>
 */
public abstract class AbstractFacade<Entity, PrimaryKey> extends AbstractQueryModel {

    private Class<Entity> entityClass;

    public AbstractFacade(Class<Entity> entityClass) {
        this.entityClass = entityClass;
    }

    public void persist(Entity entity) {
        getEntityManager().persist(entity);
    }

    public void merge(Entity entity) {
        getEntityManager().merge(entity);
    }

    public void remove(Entity entity) {
        getEntityManager().remove(entity);
    }

    public Entity find(PrimaryKey primaryKey) {
        return getEntityManager().find(entityClass, primaryKey);
    }

}
